{% extends "base.html" %}

{% block content %}
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h2 class="text-center">{{ legend }}</h2>
                </div>
                <div class="card-body">
                    <form method="POST" action="">
                        {{ form.hidden_tag() }}
                        <div class="form-group">
                            {{ form.student_id.label(class="form-control-label") }}
                            {% if form.student_id.errors %}
                                {{ form.student_id(class="form-control form-control-lg is-invalid") }}
                                <div class="invalid-feedback">
                                    {% for error in form.student_id.errors %}
                                        <span>{{ error }}</span>
                                    {% endfor %}
                                </div>
                            {% else %}
                                {{ form.student_id(class="form-control form-control-lg") }}
                            {% endif %}
                        </div>
                        <div class="form-group">
                            {{ form.name.label(class="form-control-label") }}
                            {% if form.name.errors %}
                                {{ form.name(class="form-control form-control-lg is-invalid") }}
                                <div class="invalid-feedback">
                                    {% for error in form.name.errors %}
                                        <span>{{ error }}</span>
                                    {% endfor %}
                                </div>
                            {% else %}
                                {{ form.name(class="form-control form-control-lg") }}
                            {% endif %}
                        </div>
                        <div class="form-group">
                            {{ form.gender.label(class="form-control-label") }}
                            {% if form.gender.errors %}
                                {{ form.gender(class="form-control form-control-lg is-invalid") }}
                                <div class="invalid-feedback">
                                    {% for error in form.gender.errors %}
                                        <span>{{ error }}</span>
                                    {% endfor %}
                                </div>
                            {% else %}
                                {{ form.gender(class="form-control form-control-lg") }}
                            {% endif %}
                        </div>
                        <div class="form-group">
                            {{ form.age.label(class="form-control-label") }}
                            {% if form.age.errors %}
                                {{ form.age(class="form-control form-control-lg is-invalid") }}
                                <div class="invalid-feedback">
                                    {% for error in form.age.errors %}
                                        <span>{{ error }}</span>
                                    {% endfor %}
                                </div>
                            {% else %}
                                {{ form.age(class="form-control form-control-lg") }}
                            {% endif %}
                        </div>
                        <div class="form-group">
                            {{ form.major_id.label(class="form-control-label") }}
                            {% if form.major_id.errors %}
                                {{ form.major_id(class="form-control form-control-lg is-invalid") }}
                                <div class="invalid-feedback">
                                    {% for error in form.major_id.errors %}
                                        <span>{{ error }}</span>
                                    {% endfor %}
                                </div>
                            {% else %}
                                {{ form.major_id(class="form-control form-control-lg") }}
                            {% endif %}
                        </div>
                        <div class="form-group mt-4">
                            {{ form.submit(class="btn btn-primary btn-block") }}
                        </div>
                    </form>
                </div>
                <div class="card-footer text-center">
                    <a href="{{ url_for('main.home') }}" class="btn btn-secondary">返回列表</a>
                </div>
            </div>
        </div>
    </div>
{% endblock %}